//
//  SecondViewController.m
//  SplitStoryBoard
//
//  Created by Cluy on 14/11/7.
//  Copyright (c) 2014年 sunflows. All rights reserved.
//

#import "SecondViewController.h"
#import "TableViewCell.h"
#import "Storyboard2ViewController.h"
@interface SecondViewController ()

@end

@implementation SecondViewController
@synthesize titleStr;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//    self.view.backgroundColor = [UIColor yellowColor];
    titleLable.text = self.titleStr;
    tableVw.delegate = self;
    tableVw.dataSource = self;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
#pragma mark TableViewDelagte
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 5;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    TableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:@"TableViewCell"];
    cell.infoLabel.text = [NSString stringWithFormat:@"%d",indexPath.row];
    return  cell;
                           
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPat{
    UIStoryboard *secondStoryBoard = [UIStoryboard storyboardWithName:@"Storyboard2" bundle:nil];
    Storyboard2ViewController* story2VC = [secondStoryBoard instantiateViewControllerWithIdentifier:@"storySmile"];  //storySmile为viewcontroller的StoryboardId
    [self.navigationController pushViewController:story2VC animated:YES];
}
@end
